package com.dkm.dkmproject.service.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.dkm.dkmproject.dao.BusinessTbMapper;
import com.dkm.dkmproject.domain.BusinessTb;
import com.dkm.dkmproject.service.IBusinessTbService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 业务管理 服务实现类
 * </p>
 *
 * @author 周佳佳
 * @since 2020-04-26
 */
@Service
public class BusinessTbServiceImpl extends ServiceImpl<BusinessTbMapper, BusinessTb> implements IBusinessTbService {
    @Resource
    BusinessTbMapper businessTbMapper;
    @Override
    public int addBusinessTb(BusinessTb businessTb) {
        return businessTbMapper.insert(businessTb);
    }

    @Override
    public int insertSelective(BusinessTb record) {
        return businessTbMapper.insertSelective(record);
    }

    @Override
    public List<BusinessTb> selectByPrimaryKey(String orId) {
        return businessTbMapper.selectByPrimaryKey(orId);
    }

    @Override
    public List<BusinessTb> findById(String orId) {
        EntityWrapper<BusinessTb> entityWrapper=new EntityWrapper<>();
        entityWrapper.eq("or_id",orId);
        return businessTbMapper.selectList(entityWrapper);
    }

    @Override
    public List<BusinessTb> selectAll(Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return businessTbMapper.selectAll();
    }



    @Override
    public List<BusinessTb> selectAll() {
        return businessTbMapper.selectAllTwo();
    }

    @Override
    public List<BusinessTb> selectAllThree(String exp2) {
        return businessTbMapper.selectAllThree(exp2);
    }

    @Override
    public int selectCountTwo() {
        return businessTbMapper.selectCountTwo();
    }

    @Override
    public int updateIsva(BusinessTb businessTb) {
        EntityWrapper entityWrapper=new EntityWrapper();
        entityWrapper.eq("bu_id",businessTb.getBuId());
        BusinessTb businessTb1=new BusinessTb();
        businessTb1.setExp2("2");
        businessTb1.setOrFwname("后台管理员操作");
        businessTb1.setOrFwphone("管理员电话无");
        return  businessTbMapper.update(businessTb1,entityWrapper);
    }

    @Override
    public List<BusinessTb> findByUserId() {
        return businessTbMapper.findByUserId();
    }
}
